package org.swift.mashup.engine.model.processors;

public class FromProcessorFactory {
	private static final String CSV_TO_XML = "csvToXml";
	private static final String TSV_TO_XML = "tsvToXml";
	private static final String OCTAVE_TO_XML = "octaveToXml";
	
	/**
	 * Inspect the processor string and return an instance of the appropriate FromProcessor.
	 * If the value of processor is null or not found, a NullProcessor will be returned.
	 * @param processor String representing the processor, may be null
	 * @return instance of the appropriate FromProcessor
	 */
	public static FromProcessor getFromProcessor(String processor){
		if(CSV_TO_XML.equalsIgnoreCase(processor)){
			return CsvToXmlProcessor.getInstance();
		}
		if(TSV_TO_XML.equalsIgnoreCase(processor)){
			return TsvToXmlProcessor.getInstance();
		}
		if(OCTAVE_TO_XML.equalsIgnoreCase(processor)){
			return OctaveToXmlProcessor.getInstance();
		}
		return NullProcessor.getInstance();
	}
}
